package com.wigball.java.jchef.model.ingredients;

public abstract class AbstractIngredient implements Ingredient {

	protected Integer value;

	protected String name;

	protected String measureType;

	protected String measure;

	@Override
	public final Integer getValue() {
		if (value == null) {
			throw new RuntimeException("The ingredient " + name
					+ " has no value!");
		}

		return value;
	}

	public final void setValue(Integer value) {
		this.value = value;
	}

	@Override
	public final String getName() {
		return name;
	}

	public final void setName(String name) {
		this.name = name;
	}

	@Override
	public final String getMeasureType() {
		return measureType;
	}

	public final void setMeasureType(String measureType) {
		this.measureType = measureType;
	}

	@Override
	public final String getMeasure() {
		return measure;
	}

	public final void setMeasure(String measure) {
		this.measure = measure;
	}

	@Override
	public String toString() {
		return "Ingredient [value=" + value + ", name=" + name
				+ ", measureType=" + measureType + ", measure=" + measure
				+ ", type=" + getType() + "]";
	}

}
